//
//  ProjectIntroductionViewController.m
//  TenThousand
//
//  Created by 我的 on 16/6/20.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "ProjectIntroductionViewController.h"
#import "SubsidiaryViewController.h"
#import "HomeViewController.h"


@interface ProjectIntroductionViewController ()<GUITabPagerDataSource, GUITabPagerDelegate>

@end
#define subController @[@"SubsidiaryViewController",@"SubsidiaryViewController",@"SubsidiaryViewController",@"SubsidiaryViewController"]
#define TITLE @[@"每日资产",@"转入记录",@"转出记录",@"收益记录"]

@implementation ProjectIntroductionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"新手专享标2068期";
    [self setDataSource:self];
    [self setDelegate:self];
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    NSArray *vcArray = self.navigationController.viewControllers;
    if ([[vcArray[vcArray.count-2] class] isSubclassOfClass:[HomeViewController class]]) {
        [self setHidesBottomBarWhenPushed:YES];
    }
    [self reloadData];
}

#pragma mark - Tab Pager Data Source

- (NSInteger)numberOfViewControllers {
    return subController.count;
}

- (UIViewController *)viewControllerForIndex:(NSInteger)index {
   
//    UIViewController *subViewController = [[NSClassFromString(subController[index]) alloc] init];

    SubsidiaryViewController *subViewController = [[SubsidiaryViewController alloc] init];
    subViewController.index = index;
    return subViewController;
}



//设置顶部按钮的title
- (NSString *)titleForTabAtIndex:(NSInteger)index {
    
    return [NSString stringWithFormat:@"%@", TITLE[index]];
}

- (CGFloat)tabHeight {
    
    return 40.0f;
}

//table区滑块的颜色
- (UIColor *)tabColor {
    return [UIColor colorWithRed:0.93 green:0.35 blue:0.29 alpha:1.00];
}

//table区的背景颜色
- (UIColor *)tabBackgroundColor {
    return [UIColor lightTextColor];
}

//table区的字体设置
- (UIFont *)titleFont {
    return [UIFont systemFontOfSize:13.0f];
}

//table区字体颜色
- (UIColor *)titleColor {
    return [UIColor blackColor];
}

#pragma mark - Tab Pager Delegate
//拖动时触发 将要改变的回调
- (void)tabPager:(GUITabPagerViewController *)tabPager willTransitionToTabAtIndex:(NSInteger)index {
    NSInteger selectIndex = [self selectedIndex];
    UILabel *selectLable = [self tabViews] [selectIndex];
    selectLable.textColor = [UIColor blackColor];
}
//拖动结束后的回调
- (void)tabPager:(GUITabPagerViewController *)tabPager didTransitionToTabAtIndex:(NSInteger)index {
    UILabel *lable = [self tabViews][index];
    lable.textColor = [UIColor colorWithRed:0.93 green:0.35 blue:0.29 alpha:1.00];
}



@end
